$(function () {
    $(".super-headbg a").click(function () {
        $(".popup").show();
        $(".apply").show()
    });
    $(".item-list ul li").hover(function () {
        $(this).children("div").stop().animate({bottom: "0px"}, 500)
    }, function () {
        $(this).children("div").stop().animate({bottom: "-391px"})
    });
    $(".apply-con ul li.info em a").hover(function () {
        $(".example").stop().fadeIn()
    }, function () {
        $(".example").stop().fadeOut()
    });
    $(".apply-con p a.icon-close").click(function () {
        "" != $("#cover_id_cover_id").val() ? window.location.reload() : ($(".apply").fadeOut(), $(".popup").fadeOut())
    });
    $("body").find("#index-quan-btn-form").validate({
        submitHandler: function (a) {
            if ("" == $(".mImg").val())return layer.msg("\u8bf7\u4e0a\u4f20\u80a1\u7968\u622a\u56fe\u54e6", {
                icon: 0,
                offset: 300,
                time: 2E3
            }), !1;
            a = $(a).serialize();
            doRequest("/mquan/apply.html", a, !1, function (a) {
                $(".apply").fadeOut();
                $(".popup").fadeOut();
                layer.msg(a.errorMsg, {icon: 1, offset: 300, time: 2E3}, function () {
                    window.location.reload()
                })
            }, function (a) {
                layer.msg(a.errorMsg, {icon: 0, offset: 300, time: 2E3})
            })
        },
        rules: {mName: {isName: !0}, mMobile: {isMobile: !0}, mEmail: {isEmail: !0}},
        messages: {
            mName: {required: "\u8bf7\u8f93\u5165\u771f\u5b9e\u59d3\u540d"},
            mMobile: {required: "\u8bf7\u8f93\u5165\u6709\u6548\u624b\u673a"},
            mEmail: {required: "\u8bf7\u8f93\u5165\u6709\u6548\u90ae\u7bb1"}
        },
        errorPlacement: function (a, b) {
            a.appendTo(b.parent());
            a.addClass("error")
        },
        success: function (a) {
            a.remove()
        }
    })
});
var upload_id = $("#upload_picture_cover_id")[0];
"undefined" != typeof upload_id && $("#upload_picture_cover_id").uploadify({
    height: 30,
    swf: "/static/public/uploadify/uploadify.swf",
    fileObjName: "picture",
    buttonText: "\u4e0a\u4f20\u56fe\u7247",
    uploader: "http://static.tan2.com/upload/picture.html",
    width: 120,
    removeTimeout: 1,
    removeCompleted: !1,
    fileTypeExts: "*.jpg; *.png; *.gif;",
    onUploadSuccess: uploadPicturecover_id,
    onFallback: function () {
        alert("\u672a\u68c0\u6d4b\u5230\u517c\u5bb9\u7248\u672c\u7684Flash.")
    },
    onInit: function () {
        $("#uploadify-queue").hide()
    }
});
function uploadPicturecover_id(a, b) {
    b = $.parseJSON(b);
    var c = "";
    b.status ? ($("#cover_id_cover_id").val(b.id), c = b.url || "" + b.path, $("#thumb_preview_box").html("<img src='" + c + "' onclick='zoomPicture(this)' style='cursor:url(../static/default/img/zoom_in.cur),auto;'/>")) : layer.msg(b.info, {
        icon: 0,
        time: 5E3,
        offset: 300
    })
}
function zoomPicture(a) {
    $(a);
    _url = $(a).attr("src");
    _width = $(a).width();
    _height = $(a).height();
    layer.open({
        type: 1,
        title: !1,
        closeBtn: 0,
        offset: 300,
        area: [_width, _height],
        skin: "layui-layer-nobg",
        shadeClose: !0,
        content: "<img src='" + _url + "'/>"
    })
};